<template>
  <div class="page-container">
    <SearchForm
        :search-list="searchList"
        :search-params="searchParams"
        @search="onSearch"
        @reset="onReset"
    />
    <div class="table-box">
      <el-table
          v-loading="loading"
          height="100%"
          :data="tableData"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(255, 255, 255, 0.8)"
          @selection-change="onSelect"
      >
        <el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" >
          <template slot-scope="scope">
            <el-image v-if="item.type === 'image' && scope.row[item.prop]" :preview-src-list="(scope.row[item.prop] || '').split(',')" :src="scope.row[item.prop]" style="width: 60px;height: 60px;border: 1px solid #3CAA49" fit="contain" />
            <span v-if="item.type === 'select'">
              {{ item.mapping[scope.row[item.prop]] }}
            </span>
            <span v-if="!item.type">{{ scope.row[item.prop] }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="150px">
          <template slot-scope="scope">
            <el-button type="text" @click="onEdit(scope.row)">处理</el-button>
            <el-button type="text" style="color: #F82222" @click="onDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="page-box">
      <el-pagination
          background
          :current-page="pageNo"
          :page-sizes="pageSizes"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="totalSize"
          @size-change="changePageSize"
          @current-change="changePageNo"
      />
    </div>
    <Add ref="addFormRef" @get-page="initData" />

  </div>
</template>

<script>
import crud from '@/mixins/crud'
import { http } from '@/api'
import Add from "./add.vue";
export default {
  name: 'category',
  components: {Add},
  mixins: [crud],
  data() {
    return {
      request: http.feedback,
      searchList: [
        {
          key: 'member_name',
          name: 'input',
          label: '反馈用户'
        }
      ],
      searchParams: {
        name: ''
      },
      columns: [
        { prop: 'member_name', label: '反馈用户' },
        { prop: 'create_time', label: '反馈时间' },
        { prop: 'content', label: '反馈内容' },
        { prop: 'nickname', label: '联系人' },
        { prop: 'phone', label: '联系方式' },
        { prop: 'result', label: '处理结果' },
      ],
      tableData: [
      ]
    }
  },
  methods: {
    formatTableData(data) {
      data.forEach(el => {

      })
    },
    onAdd() {
      this.$refs.addFormRef.open()
    },
    onEdit(row) {
      this.$refs.addFormRef.open(row)
    }
  }
}
</script>

<style scoped lang="scss">
</style>
